package com.fanghaoran.controller;

import com.fanghaoran.bean.Interaction;
import com.fanghaoran.entity.Users;
import com.fanghaoran.service.InfoService;

import java.sql.SQLException;

/**
 * @Author: win11
 * @Date: 2023/03/22/13:45
 * @Description: 用户查看/编辑个人信息操作的控制层
 */
public class InfoController {
    /**
     * service层对象 负责业务处理
     */
    private final InfoService infoService=new InfoService();

    /**
     *通过用户名获取用户信息
     */
    public Interaction getInfo(String username) throws Exception {
        return infoService.getInfo(username);
    }

    /**
     *编辑用户信息
     */
    public Interaction updateInfo(Users user, String oldUsername, String oldTelephone) throws Exception {
        return infoService.updateInfo(user,oldUsername,oldTelephone);
    }

    /**
     *修改密码
     */
    public Interaction modifyPassword(Users user,String oriPasswordInput,String modifiedPasswordInput,String inputAgain) throws SQLException {
        return infoService.modifyPassword(user,oriPasswordInput,modifiedPasswordInput,inputAgain);
    }
}
